package com.xjtu.chapter05.ex5_5;

/**
 * @author yjq
 * @version 1.0
 * @date 2021/8/17 11:20
 */
public class WriteStory {

    private class MyPencil extends Pencil {
        //定义一个private类继承自抽象类
        private int i = 5;

        @Override
        public int value() {
            return i;
        }
    }

    protected class MyPaper implements Paper {//内部类实现接口Paper
        private String line;

        private MyPaper(String line) {
            this.line = line;
        }

        @Override
        public String mark() {
            return line;
        }
    }

    public Paper writeDown(String s) {
        return new MyPaper(s);
    }

    public Pencil pen() {
        return new MyPencil();
    }
}
